package de.baumann.browser.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import de.baumann.browser.OdinGlideModule;
import de.baumann.browser.R;
import de.baumann.browser.api.net.vo.Member;
import de.baumann.browser.utils.StringUtil;

public class NodeMemberListAdapter extends BaseQuickAdapter<Member, BaseViewHolder> {

    public NodeMemberListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, Member item) {

        helper.setText(R.id.tvMemberHash, "算力值:" + item.getContribute());
        helper.setText(R.id.tvMemberJoinTime, "加入时间:" + item.getJoinTime());
        helper.setText(R.id.tvMemberProportion, String.format("(约占比%s)", item.getProportion()));
        ImageView ivMemberHead = helper.getView(R.id.ivMemberHead);
        OdinGlideModule.loadWithCropAndCircle(mContext, item.getAvatar(), ivMemberHead, R.drawable.icon_head);
    }
}
